package com.moresir.validatetools.exceptions;


import com.moresir.validatetools.common.response.ResponseEnum;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@NoArgsConstructor
@Getter
@Setter
public class BusinessException extends RuntimeException {

    /**
     * 返回码
     */
    private Integer code;


    public BusinessException(ResponseEnum responseEnum) {
        super(responseEnum.getZhMsg());
        this.code = responseEnum.getCode();
    }

    public BusinessException(Integer code, String msg) {
        super(msg);
        this.code = code;
    }

    public BusinessException(ResponseEnum responseEnum, String msg){
        super(responseEnum.getZhMsg() + " : " + msg);
        this.code = responseEnum.getCode();
    }
}